/* file: post-send by: A.C. van der Ham e-mail: a.c.vanderham@et.tudelft.nl purpose: to be used together with digester to enable easy reply to messages warning: only works with UNIX servers for now where: compile it and put it in your html scripts directory notice: don't forget to set the correct path for the info-mac files */ #define PATH "/home/vdham/Mosaic/info-mac/" #include #include #include #define MAXLINE 512 #define OK 0 #define ERROR 1 #define ITEMTEXT "", stdout ); do { fgets( line, 256, inP ); if( (strstr(line,"<")==NULL) && (strstr(line,">")==NULL) ) fputs( line, stdout ); if( (cptr=strstr( line, "From: " ))!=NULL ) { if( strstr(line, "mailto:")!=NULL ) { cptr=strstr(line, "mailto:")+strlen("mailto:"); strcpy(address, cptr); if((cptr=strstr(address, ">"))!=NULL) *cptr=0; } else { cptr += 6; strcpy(address, cptr); if( (cptr=strstr(address,"\n")) != NULL) *cptr=0; if( (cptr=strstr(address,"<")) != NULL) { strcpy(address, cptr+4); if( (cptr=strstr(address,">")) != NULL) *cptr=0; } if( (cptr=strstr(address," ")) != NULL) *cptr=0; } } } while( (!feof(inP)) && (strstr(line, EOM)==NULL) ); fputs( "", stdout ); fprintf( stdout, "Reply to: %s

\n", address, address ); fprintf( stdout, "Reply to: %s

\n", INFOMAC, INFOMAC ); fclose(inP); } else { return(ERROR); } return(OK); } int main( int argc, char *argv[] ) { char *cptr; char file[80]; int item=0; argc=argc; fprintf(stdout, "Content-type: text/html\n\n"); if( argv[1]!=NULL) { if((cptr=strstr(argv[1],","))!=NULL) { *cptr=0; item=atoi(argv[1]); strcpy(file, cptr+1); if( findmessage( item, file ) == ERROR) { fprintf(stdout, "can't find message\n"); fprintf(stdout, "Sorry, something went wrong in message selection.

\n"); fprintf(stdout, "Please notify: André van der Ham.

\n"); fprintf(stdout, "ERROR: can't find message?!\n"); } } else { fprintf(stdout, "no delimiter\n"); fprintf(stdout, "Sorry, something went wrong in message selection.

\n"); fprintf(stdout, "Please notify: André van der Ham.

\n"); fprintf(stdout, "ERROR: File name delimiter not found?!\n"); } } else { fprintf(stdout, "no arguments\n"); fprintf(stdout, "Sorry, something went wrong in message selection.

\n"); fprintf(stdout, "Please notify: André van der Ham.

\n"); fprintf(stdout, "ERROR: Can't find any arguments to query?!\n"); } return(0); }